#include<stdio.h>
#include<stdlib.h>
#define MAXN 102
int a[MAXN],dp[MAXN];

int main(){
    int n,i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        a[i] = 0;
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    for(i=1;i<=n;i++)
        dp[i] = 1;
    for(i=1;i<=n;i++){
        for(j=1;j<i;j++){
            if(a[j]<a[i]&&dp[j]+1>dp[i]){
                dp[i] = dp[j] + 1;
            }
        }
    }
    j = 0;
    for(i=1;i<=n;i++){
            if(dp[i]>j)
                j = dp[i];
    }
    printf("%d\n",j);
    return 0;
}
